package br.com.linhadotempo.dao;

import java.util.List;

import br.com.linhadotempo.util.Mensagens;
import br.com.taimlain.modelo.Auth;

public class AuthDAO extends DaoMestre<Auth> {

	public AuthDAO() {
		super();
	}
	
	public Auth getAuthbyUsername(Auth auth){
		String sql = "FROM Auth WHERE username = ?1";

		try {
			List<Auth> resultList = searchTheDatabase(sql, auth.getUsername());
			if (resultList.size() > 0) {
				return (Auth) resultList.get(0);
			}
			return null;
		} catch (Exception e) {
			e.printStackTrace();
			Mensagens.getInstance().setError(e.getCause().getMessage());
			return null;
		}
	}

}
